import {Injectable} from "@angular/core";
import {HttpService} from "../HttpService";
import {ResponseData} from "../model/ResponseData";
import {Http, ResponseContentType} from "@angular/http";
import {JSSBDownloadFile} from "../model/JSSBDownloadFile";


/**
 * 获得下载链接
 */
@Injectable()
export class JSSBDownloadService extends HttpService{

    protected listUrl:string="GetJSSBFileList";

    protected downUrl:string="DownloadJSSBFile";


    constructor(private http:Http){super()};


   public getFilesList():Promise<ResponseData<JSSBDownloadFile[]>>{

       return this.http.get(this.prefix + this.listUrl)
            .map(response => {
                return  response.json() as ResponseData<JSSBDownloadFile[]>;
            }).toPromise();
    }


    public getFile(id:number):string{
        return this.prefix+this.downUrl+"?id="+id;
    }




}
